import { createApp } from "vue";
import MonitorSdk from "dg_monitor"
import * as echarts from 'echarts';
import App from "@/App.vue";
import router from "@/router";
import store from "@/store";
import request from "@/request";
import { adminStorage } from '@/utils/storage'
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import ElementPlus from "element-plus";
// import "element-plus/dist/index.css";
// import "@/assets/style/realize/element-variable.scss";
import "@/assets/style/index.scss";
import VXETable from "vxe-table";
import "vxe-table/lib/style.css";
import LinNotify from "@/components/notify";
import plugin from "@/components/plugin";

import select from "@/components/select";
import svgIcon from '@/components/svgIcon' //引入svg

const app = createApp(App);
function useTable(app) {
  app.use(VXETable);
  // 给 vue 实例挂载内部对象，例如：
  // app.config.globalProperties.$XModal = VXETable.modal
  // app.config.globalProperties.$XPrint = VXETable.print
  // app.config.globalProperties.$XSaveFile = VXETable.saveFile
  // app.config.globalProperties.$XReadFile = VXETable.readFile
}


let dt_Monitor = new MonitorSdk({
  reportWay: 'router', 
  is_test: false,
  // baseUrl: 'http://localhost:8777/static',//  数据上传服务器地址,
  baseUrl: process.env.NODE_ENV !== 'production' ? 'http://localhost:8777/static' : 'http://111.92.241.91:9999/static',//  数据上传服务器地址,
})
// console.log(app.config.errorHandler, 'app.config.errorHandler');

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.config.globalProperties.$http = request;
app.config.globalProperties.$util = adminStorage;
app.config.globalProperties.$dt = dt_Monitor;
app.config.globalProperties.$echarts = echarts;

app.use(useTable);
app.use(select);
app.use(svgIcon);
app.use(ElementPlus);
app.use(router);
app.use(store);
app.use(LinNotify, {
  connection: '/admin'
});
app.use(plugin);

app.mount("#app");
